//
// Created by Asus on 2025/6/2.
//

#include <iostream>
#include <string>
#include <bits/ostream.tcc>
using namespace std;

void demo01() {
    string str1 = "abcde";
    int pos = str1.find("de");
    if (pos == string::npos) { // 或者 pos == -1
        cout << "没找到" << endl;
    } else {
        cout << "pos:" << pos << endl;
    }
    string str2 = "123456";
    pos = str2.rfind("6");
    cout << pos << endl;
}

void demo02() {
    // 替换
    string str1 = "abcde";
    str1.replace(0, 3, "11");
    cout << "str1:" << str1 << endl;
}

int main(int argc, char *argv[]) {
    demo01();
    demo02();
    return 0;
}
